import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "/home",
    },
    {
      path: "/home",
      component: () => import("../pages/home/Index.vue"),
      children: [
        {
          path: "/home",
          redirect: "/home/index",
        },
        {
          path: "/home/index",
          component: () => import("../pages/home/index/Index.vue"),
        },
        {
          path: "/home/classify",
          component: () => import("../pages/home/classify/Index.vue"),
        },
        {
          path: "/home/cart",
          component: () => import("../pages/home/cart/Index.vue"),
        },
        {
          path: "/home/mine",
          component: () => import("../pages/home/mine/Index.vue"),
        },
      ],
    },
    {
      path: "/login",
      component: () => import("../pages/login/Index.vue"),
    },
    {
      path: "/detail",
      component: () => import("../pages/detail/Index.vue"),
    },
    {
      path: "/:pathMatch(.*)*",
      component: () => import("../pages/notFound/Index.vue"),
    },
  ],
});

export default router;
